<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="/struts-tags" prefix="s"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>网上书城</title>
<link href="CSS/stylesheet.css" rel="stylesheet" type="text/css">
<script type="text/javascript" src="JS/jsonrpc.js"></script>
</head>

<body class="body">
	<table width="780" border="0" align="center" cellpadding="0"
		cellspacing="0" bgcolor="#FFFFFF"
		style="border: 1px; border-style: solid; border-color: #888888">
		<tr>
			<td width="20">&nbsp;</td>
			<TD height="50" align="right" valign="bottom"><IMG
				src="images/icon_login.gif" align="absmiddle"> <INPUT
				id="qKey" name="qKey" value="商品关键字" onClick="this.value=''">
				<select id="category">
					<option value="0">所有商品</option>

			</select> <A href="javascript:QuickSearch()"><IMG
					src="images/icon_search.gif" align="absmiddle" border="0"></A></TD>
			<td width="20">&nbsp;</td>
		</tr>

		<tr>
			<td>&nbsp;</td>
			<td>
				<TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>
					<TR align="center">
						<TD valign="top" width="9"><IMG src="images/icon02.gif"></TD>
						<s:if test="#session.user_name!=null">
							<TD class="header_menu" align="middle"><span
								class="whiteTitle">欢迎您，${session.user_name}</span></TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
							<TD class="header_menu" align="middle"><A
								href="cartAction_showCart.action"><span class="whiteTitle">查看购物车</span></A>
							</TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
							<TD class="header_menu" align="middle"><A
								href="orderAction_showUserOrder.action"><span
									class="whiteTitle">查看已提交订单</span></A></TD>
							<TD background="images/Bule_06.gif" width="2"></TD>

							<TD class="header_menu" align="middle"><A
								href="userInfoAction_showInfo.action"><span
									class="whiteTitle">个人信息</span></A></TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
							<TD class="header_menu" align="middle"><A
								href="loginAction_logout.action"><span class="whiteTitle">注销</span></A></TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
						</s:if>
						<s:else>
							<TD class="header_menu" align="middle"><A
								href="register.jsp"><span class="whiteTitle">注册</span></A></TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
							<TD class="header_menu" align="middle"><A
								href="cartAction_showCart.action"><span class="whiteTitle">查看购物车</span></A>
							</TD>
							<TD background="images/Bule_06.gif" width="2"></TD>
							<TD class="header_menu" align="middle"><A href="login.jsp"><span
									class="whiteTitle">登陆<bean:message key="menu.item2" /></span></A></TD>

						</s:else>
						<TD vAlign=top width=7><IMG src="images/icon07.gif"></TD>
					</TR>
				</TABLE>
			</td>
			<td>&nbsp;</td>
		</tr>

		<tr>
			<td>&nbsp;</td>
			<td><table width="100%" border="0" cellpadding="0"
					cellspacing="0">
					<tr>
						<td valign="top"><br>
							<TABLE width="96%" border=0 align="center" cellPadding=0
								cellSpacing=0 class="C_Goods_Title">
								<TR>
									<TD><IMG hspace=5 src="images/NewGoods_04.gif"></TD>
								</TR>
							</TABLE>
							<table width="96%" border="0" align="center" cellpadding="0"
								cellspacing="1" bgcolor="#F7F3F7">
								<tr bgcolor="#F7F3F7" valign="middle" align="center">
									<td height="30" class="blackTitle">图片</td>
									<td height="30" class="blackTitle">书名</td>
									<td height="30" class="blackTitle">价格</td>
									<td height="30" class="blackTitle">操作</td>
								</tr>


								<s:iterator value="#request.booklist" var="book">
									<tr valign="middle" bgcolor="#FFFFFF">
										<td width="100" align="center"><img
											src="uploadFiles/${book.picPath}" width="100" height="150"></td>
										<td width="160" align="center" class="text"><a
											href="bookAction.action?method=showMer&id=${mer.id}"
											target=_blank><span class="blueText">${mer.merName}</span></a><br>
											<br> ${book.name}<br></td>
										<td class="text" align="center">${book.price}</td>
										<td width="100"><a href="cartAction_showCart.action"><img
												src="images/icon_car.gif" border=0></a><br> <a
											href="cartAction_addToCart.action?bookNameToAdd=${book.name}"><img
												alt="" src="images/icon_buy.gif" border=0></a></td>
									</tr>
									<tr>
										<td colspan="4" height="2" bgcolor="#F7F3F7"></td>
									</tr>
								</s:iterator>


							</table></td>
					</tr>
				</table></td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<s:if test="1==2">
				<s:iterator value="#request.booklist" var="book">
					<tr>
						<td><s:property value="#book.name" /></td>
						<td><s:property value="#book.price" /></td>
						<td><s:property value="#book.num" /></td>
					</tr>
				</s:iterator>
			</s:if>
			<s:if test="2==3">
				<td><s:property value="#session.user_name" /></td>
			</s:if>


		</tr>
		<tr>
			<td colspan="3">&nbsp;</td>
		</tr>
		<tr>
			<td>&nbsp;</td>
			<td height="30" bgcolor="#4282CE" class="whiteText" align="center">
				<bean:message key="website.foot" />
			</td>
			<td>&nbsp;</td>
		</tr>
		<tr>
			<td height="20" colspan="3">&nbsp;</td>
		</tr>
	</table>
	<script type="text/javascript">
		//构造商品分类下拉列表
		jsonrpc = new JSONRpcClient("JSON-RPC");
		var result = jsonrpc.ajax.getCategory();
		for ( var i = 0; i < result.length; i++) {
			option = document.createElement("OPTION");
			option.value = result[i][0];
			option.text = result[i][1];
			document.all.category.options.add(option);
		}

		//是否输入数字
		function isNumber() {
			return ((event.keyCode > 47) && (event.keyCode < 58));
		}

		//搜索商品
		function QuickSearch() {
			/* var url = "mer.do?method=searchMer&cateid="
					+ document.all.category.value;
			var key = document.all.qKey.value;
			if (key != null && key != "商品关键字" && key.length > 0)
				url = url + "&key=" + key;
			window.location = url; */
			alert("搜索成功");
		}
	</script>
</body>

</html>